<?php
 include_once('connection/connection.php');
	$data=$_GET['data'];
    $val=$_GET['val'];
	$schNo=$_GET['schNo'];
	if($schNo=='P')
	{
	$schNo='P&T';
	}
function getName($colName,$id)
{
	$sqlgetName="select distinct ".$colName."_name from tbl_lookup_location where ".$colName."_id=".$id;
	$querygetName=mysql_query($sqlgetName);
	$rowgetName=mysql_fetch_row($querygetName);
	return $rowgetName[0];
}


	
	 if($data=='form_id')
	 {	
          echo "<select name='form_id' id='form_id' class='txt'>\n";
          echo "<option value='0'>==== Block ====</option>\n";
		   $result=mysql_query("select DISTINCT block_id from tbl_dtls_q2_main where district_id='$val'");
		     while(list($id)=mysql_fetch_array($result))
		        {
                  $block_name[$id]=getName('block',$id);
                }
		          asort($block_name);
         
		          foreach($block_name as $key=>$val)
		        	{
			           echo "<option value=\"$key\">".$val."</option> \n" ;
			        }
         
		  echo "</select>";  	
		}
		
?>
